package top.tangyh.lamp.care.service;

import cn.hutool.core.collection.CollectionUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import groovy.lang.Lazy;
import top.tangyh.basic.base.service.SuperService;
import top.tangyh.basic.exception.BizException;
import top.tangyh.lamp.care.entity.BCareRecord;
import top.tangyh.lamp.care.vo.query.CareItemQueryParam;
import top.tangyh.lamp.care.vo.query.CareRecordQueryDto;
import top.tangyh.lamp.care.vo.query.CareRecordQueryParam;
import top.tangyh.lamp.care.vo.result.*;
import top.tangyh.lamp.care.vo.save.BCareRecordSaveVO;
import top.tangyh.lamp.care.vo.save.FanShenRecordInputDTO;
import top.tangyh.lamp.care.vo.update.BCareRecordUpdateVO;
import top.tangyh.lamp.care.vo.query.BCareRecordPageQuery;
import top.tangyh.lamp.care.vo.update.CareRecordDelInVO;
import top.tangyh.lamp.care.vo.update.UpdateCareRecordStatusVO;

import java.time.LocalDateTime;
import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.Set;


/**
 * <p>
 * 业务接口
 * 护理操作记录表
 * </p>
 *
 * @author zqb
 * @date 2024-07-18 14:10:32
 * @create [2024-07-18 14:10:32] [zqb] [代码生成器生成]
 */

public interface BCareRecordService extends SuperService<Long, BCareRecord> {

    CareRecordQuery2AxiosDto queryBy2Axios(CareRecordQueryParam param);

    List<CareRecordQueryDto> query(CareRecordQueryParam param);
    /**
     * 获取护理操作选项
     *
     * @param  careItemQueryParam
     * @return
     */
    List<CareItemVO> itemQuery(CareItemQueryParam careItemQueryParam);


    /**
     * 新增修改
     *
     * @param param 保存参数
     * @return
     */
    Integer addAndUpdate(List<CareRecordQueryDto> param);



    /**
     * 逻辑删除除指定病人、指定时间点、指定项间的护理操作记录
     *
     * @param param 册除参数
     * @return
     */
//    default Integer delCell(CareRecordDelInVO param) {
//
//        LambdaQueryWrapper<BCareRecord> queryWrapper = new LambdaQueryWrapper<>();
//        queryWrapper.eq(BCareRecord::getHospitalNumber, param.getHospitalNumber())
//                .eq(BCareRecord::getMappedTime, param.getMappedTime())
//                .eq(BCareRecord::getItemCode, param.getItemCode());
//        List<BCareRecord> list = getBaseMapper().selectList(queryWrapper);
//        if(CollectionUtil.isNotEmpty(list)){
//            if(null != SecurityUtil.checkRecordAuth(list.get(0).getCreateBy() ,list.get(0).getUpdateBy())){
//                throw new BizException(SecurityUtil.checkRecordAuth(list.get(0).getCreateBy() ,list.get(0).getUpdateBy()));
//            }
//        }
//        return getBaseMapper().delete(queryWrapper);
//    }
    Integer delCell(CareRecordDelInVO param);

    /**
     * 更改该病人该时间点所有护理操作的状态
     *
     * @param updateStatusVO 逻辑删除参数
     */
    void updateRecordStatus(UpdateCareRecordStatusVO updateStatusVO);


    /**
     * 查询护理操作中关于翻身的记录
     *
     * @param fanShenRecordInputDTO
     * @return
     */
    PageOutputDTO<FanShenRecordOutputDTO> queryFanShenRecord(FanShenRecordInputDTO fanShenRecordInputDTO);

    List<FanShenRecordOutputDTO> queryAllFanShenRecord(FanShenRecordInputDTO fanShenRecordInputDTO);


    /**
     * 删除病人时间点所有护理记录
     *
     * @param  patientIdent 病人识别号
     * @param  hospitalNumber 住院号
     * @param  timePoint 时间点
     * @return
     */
    void delCellByTimePiont(String patientIdent, String hospitalNumber, LocalDateTime timePoint);

    /**
     * 获取病人护理操作选项
     *
     * @param  patientIdent 病人识别号
     * @return
     */
    Map<String,CareItemVO> itemQueryByPatientIdent(String patientIdent);

    void saveList(List<CareRecordQueryDto> hlcz, Long recordTime, String operator, String patientIdent, Set<String> hlczcodes);

}


